<?php 
		$links=Episode::model()->findAll(
    			array(
    				'condition'=>'t.eid = '.$data->id,
    			)
    	);
?>
<div class="episodeview">
	<label><?php echo $data->name;?></label>
	<?php 
	$i=0;
	foreach($links as $link):?>
		<?php 
		$ep=Yii::app()->getRequest()->getQuery('e',0);
		if($ep==0 && $i==0):?>
		<a id="active" href="<?php echo Yii::app()->createUrl('/film/view',array('id'=>Yii::app()->request->getParam('id'),'s'=>$data->id,'e'=>$link->id));?>" title="<?php echo $link->name;?>"
			class="link"><?php echo $link->name;?>
		</a>
		<?php elseif ($ep==$link->id):?>
			<a id="active" href="<?php echo Yii::app()->createUrl('/film/view',array('id'=>Yii::app()->request->getParam('id'),'s'=>$data->id,'e'=>$link->id));?>" title="<?php echo $link->name;?>"
			class="link"><?php echo $link->name;?>
			</a>
		<?php else:?>
			<a href="<?php echo Yii::app()->createUrl('/film/view',array('id'=>Yii::app()->request->getParam('id'),'s'=>$data->id,'e'=>$link->id));?>" title="<?php echo $link->name;?>"
				class="link"><?php echo $link->name;?>
			</a>
		<?php endif; ?>
	<?php 
	$i++;
	endforeach;?>
</div> 